package com.bupt.kgplatform.controller.jinrui;


import com.bupt.kgplatform.entity.pojo.NewsInfoSearchPojo;
import com.bupt.kgplatform.entity.pojo.Result;
import com.bupt.kgplatform.service.NewsInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:NewsInfoController
 * Package:com.example.blackjavaweb.controller
 * Description:
 *
 * @Author QIQI_1999
 * @Creat 2023/10/8 15:06
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/data")
public class NewsInfoController {

    @Autowired
    private NewsInfoService newsInfoService;

    @PostMapping("digitaltextcollection")
    public Result newsDigitalCollection(@RequestBody NewsInfoSearchPojo newsInfoSearchPojo){

        log.info("查询信息：{}",newsInfoSearchPojo);

        Object newsList = newsInfoService.getInfo(newsInfoSearchPojo);

        return Result.success(newsList);
    }

    @PostMapping("newscount")
    public Result newsInfoCount(@RequestBody  NewsInfoSearchPojo newsInfoSearchPojo){
        log.info("查询信息：{}",newsInfoSearchPojo);

        Object newsInfo = newsInfoService.getCount(newsInfoSearchPojo);

        return Result.success(newsInfo);
    }

}
